<?php
class Util_Tourist{
    public function getTouristInfoById($uid){
        $user_info = DB::select()
            ->from('user_v2_userinfo')
            ->where('uid','=',$uid)
            ->execute()
            ->current();

        $user_info2 = DB::select()
            ->from('user_v2')
            ->where('uid','=',$uid)
            ->execute()
            ->current();

        $data = array(
            'userFamily'=>$user_info['userFamily'],
            'userName'=>$user_info['userName'],
            'userGender'=>$user_info['userGender']  ,
            'userAge'=>$user_info['userAge'],
            'userIcon'=>$user_info['userIcon'],
            'userPhone'=>$user_info['userPhone'],
            'mail'=>$user_info2['email'],
            'utype'=>'TOURIST',
        );

        return $data;
    }

    public function touristAccount($uid){
        $account = DB::select()
            ->from('user_v2')
            ->where('uid','=',$uid)
            ->execute()
            ->current();
        return $account;
    }

    public function touristEmail($uid){
        $account = $this->touristAccount($uid);
        if($account['active']){
            $data['email'] = $account['email'];
        }else{
            $data = '';
        }
        return $data;
    }

}